<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>03计算属性</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
    <div id="demo">
        姓: <input type="text" v-model="firstName"> <br/><br/>
        名: <input type="text" v-model="lastName"> <br/><br/>
        全称: <span>{{fullName}}</span>
    </div>
    <script type="text/javascript">
        Vue.config.productionTip = false
        new Vue({
            el: '#demo',
            data: {
                firstName:"蒙奇.D.",
                lastName:'路飞'
            },
            computed: {
                fullName(){
                    const {firstName,lastName} =this
                    return firstName[0].toUpperCase()+ firstName.slice(1)+'-'+lastName
                }
            }
        })
    </script>
</body>

</html>